import com.note.config.SpringConfig;
import com.note.user.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test {
    public static void main(String[] args) {
        //ApplicationContext applicationContext=new ClassPathXmlApplicationContext("beans.xml");
        //此时Spring配置文件删除也可。
        ApplicationContext applicationContext=new AnnotationConfigApplicationContext(SpringConfig.class);
        User user = applicationContext.getBean("user", User.class);
        Object dataSource = applicationContext.getBean("dataSource");
        System.out.println(dataSource);
        System.out.println(user);
    }
}
